3.53 \(\int (c+d \tan (e+f x)) (A+B \tan (e+f x)+C \tan ^2(e+f x)) \, dx\)

Optimal. Leaf size=73 \[ -\frac{(d (A-C)+B c) \log (\cos (e+f x))}{f}+x (A c-B d-c C)+\frac{B d \tan (e+f x)}{f}+\frac{C (c+d \tan (e+f x))^2}{2 d f} \]

[Out]

(A*c - c*C - B*d)*x - ((B*c + (A - C)*d)*Log[Cos[e + f*x]])/f + (B*d*Tan[e + f*x])/f + (C*(c + d*Tan[e + f*x])
^2)/(2*d*f)

________________________________________________________________________________________

Rubi [A]  time = 0.0606425, antiderivative size = 73, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 31, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.097, Rules used = {3630, 3525, 3475} \[ -\frac{(d (A-C)+B c) \log (\cos (e+f x))}{f}+x (A c-B d-c C)+\frac{B d \tan (e+f x)}{f}+\frac{C (c+d \tan (e+f x))^2}{2 d f} \]

Antiderivative was successfully verified.

[In]

Int[(c + d*Tan[e + f*x])*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2),x]

[Out]

(A*c - c*C - B*d)*x - ((B*c + (A - C)*d)*Log[Cos[e + f*x]])/f + (B*d*Tan[e + f*x])/f + (C*(c + d*Tan[e + f*x])
^2)/(2*d*f)

Rule 3630

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (
f_.)*(x_)]^2), x_Symbol] :> Simp[(C*(a + b*Tan[e + f*x])^(m + 1))/(b*f*(m + 1)), x] + Int[(a + b*Tan[e + f*x])
^m*Simp[A - C + B*Tan[e + f*x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] && NeQ[A*b^2 - a*b*B + a^2*C, 0]
&&  !LeQ[m, -1]

Rule 3525

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[(b*d*Tan[e + f*x])/f, x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int (c+d \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx &=\frac{C (c+d \tan (e+f x))^2}{2 d f}+\int (A-C+B \tan (e+f x)) (c+d \tan (e+f x)) \, dx\\ &=(A c-c C-B d) x+\frac{B d \tan (e+f x)}{f}+\frac{C (c+d \tan (e+f x))^2}{2 d f}+(B c+(A-C) d) \int \tan (e+f x) \, dx\\ &=(A c-c C-B d) x-\frac{(B c+(A-C) d) \log (\cos (e+f x))}{f}+\frac{B d \tan (e+f x)}{f}+\frac{C (c+d \tan (e+f x))^2}{2 d f}\\ \end{align*}

Mathematica [A]  time = 0.446251, size = 76, normalized size = 1.04 \[ \frac{-2 (d (A-C)+B c) \log (\cos (e+f x))+2 A c f x-2 (B d+c C) \tan ^{-1}(\tan (e+f x))+2 (B d+c C) \tan (e+f x)+C d \tan ^2(e+f x)}{2 f} \]

Antiderivative was successfully verified.

[In]

Integrate[(c + d*Tan[e + f*x])*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2),x]

[Out]

(2*A*c*f*x - 2*(c*C + B*d)*ArcTan[Tan[e + f*x]] - 2*(B*c + (A - C)*d)*Log[Cos[e + f*x]] + 2*(c*C + B*d)*Tan[e
+ f*x] + C*d*Tan[e + f*x]^2)/(2*f)

________________________________________________________________________________________

Maple [A]  time = 0.014, size = 136, normalized size = 1.9 \begin{align*}{\frac{C \left ( \tan \left ( fx+e \right ) \right ) ^{2}d}{2\,f}}+{\frac{B\tan \left ( fx+e \right ) d}{f}}+{\frac{C\tan \left ( fx+e \right ) c}{f}}+{\frac{\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) Ad}{2\,f}}+{\frac{\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) Bc}{2\,f}}-{\frac{\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) Cd}{2\,f}}+{\frac{A\arctan \left ( \tan \left ( fx+e \right ) \right ) c}{f}}-{\frac{B\arctan \left ( \tan \left ( fx+e \right ) \right ) d}{f}}-{\frac{C\arctan \left ( \tan \left ( fx+e \right ) \right ) c}{f}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c+d*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2),x)

[Out]

1/2/f*C*d*tan(f*x+e)^2+B*d*tan(f*x+e)/f+1/f*c*C*tan(f*x+e)+1/2/f*ln(1+tan(f*x+e)^2)*A*d+1/2/f*ln(1+tan(f*x+e)^
2)*B*c-1/2/f*ln(1+tan(f*x+e)^2)*C*d+1/f*A*arctan(tan(f*x+e))*c-1/f*B*arctan(tan(f*x+e))*d-1/f*C*arctan(tan(f*x
+e))*c

________________________________________________________________________________________

Maxima [A]  time = 1.47783, size = 100, normalized size = 1.37 \begin{align*} \frac{C d \tan \left (f x + e\right )^{2} + 2 \,{\left ({\left (A - C\right )} c - B d\right )}{\left (f x + e\right )} +{\left (B c +{\left (A - C\right )} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 2 \,{\left (C c + B d\right )} \tan \left (f x + e\right )}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2),x, algorithm="maxima")

[Out]

1/2*(C*d*tan(f*x + e)^2 + 2*((A - C)*c - B*d)*(f*x + e) + (B*c + (A - C)*d)*log(tan(f*x + e)^2 + 1) + 2*(C*c +
 B*d)*tan(f*x + e))/f

________________________________________________________________________________________

Fricas [A]  time = 1.06793, size = 177, normalized size = 2.42 \begin{align*} \frac{C d \tan \left (f x + e\right )^{2} + 2 \,{\left ({\left (A - C\right )} c - B d\right )} f x -{\left (B c +{\left (A - C\right )} d\right )} \log \left (\frac{1}{\tan \left (f x + e\right )^{2} + 1}\right ) + 2 \,{\left (C c + B d\right )} \tan \left (f x + e\right )}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2),x, algorithm="fricas")

[Out]

1/2*(C*d*tan(f*x + e)^2 + 2*((A - C)*c - B*d)*f*x - (B*c + (A - C)*d)*log(1/(tan(f*x + e)^2 + 1)) + 2*(C*c + B
*d)*tan(f*x + e))/f

________________________________________________________________________________________

Sympy [A]  time = 0.705185, size = 131, normalized size = 1.79 \begin{align*} \begin{cases} A c x + \frac{A d \log{\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac{B c \log{\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} - B d x + \frac{B d \tan{\left (e + f x \right )}}{f} - C c x + \frac{C c \tan{\left (e + f x \right )}}{f} - \frac{C d \log{\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac{C d \tan ^{2}{\left (e + f x \right )}}{2 f} & \text{for}\: f \neq 0 \\x \left (c + d \tan{\left (e \right )}\right ) \left (A + B \tan{\left (e \right )} + C \tan ^{2}{\left (e \right )}\right ) & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)**2),x)

[Out]

Piecewise((A*c*x + A*d*log(tan(e + f*x)**2 + 1)/(2*f) + B*c*log(tan(e + f*x)**2 + 1)/(2*f) - B*d*x + B*d*tan(e
 + f*x)/f - C*c*x + C*c*tan(e + f*x)/f - C*d*log(tan(e + f*x)**2 + 1)/(2*f) + C*d*tan(e + f*x)**2/(2*f), Ne(f,
 0)), (x*(c + d*tan(e))*(A + B*tan(e) + C*tan(e)**2), True))

________________________________________________________________________________________

Giac [B]  time = 1.81836, size = 1239, normalized size = 16.97 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2),x, algorithm="giac")

[Out]

1/2*(2*A*c*f*x*tan(f*x)^2*tan(e)^2 - 2*C*c*f*x*tan(f*x)^2*tan(e)^2 - 2*B*d*f*x*tan(f*x)^2*tan(e)^2 - B*c*log(4
*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan
(e) + 1))*tan(f*x)^2*tan(e)^2 - A*d*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)
^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)^2*tan(e)^2 + C*d*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*
tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)^2*tan(e)^
2 - 4*A*c*f*x*tan(f*x)*tan(e) + 4*C*c*f*x*tan(f*x)*tan(e) + 4*B*d*f*x*tan(f*x)*tan(e) + C*d*tan(f*x)^2*tan(e)^
2 + 2*B*c*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 -
 2*tan(f*x)*tan(e) + 1))*tan(f*x)*tan(e) + 2*A*d*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(
e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)*tan(e) - 2*C*d*log(4*(tan(e)^2 + 1)/(
tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x
)*tan(e) - 2*C*c*tan(f*x)^2*tan(e) - 2*B*d*tan(f*x)^2*tan(e) - 2*C*c*tan(f*x)*tan(e)^2 - 2*B*d*tan(f*x)*tan(e)
^2 + 2*A*c*f*x - 2*C*c*f*x - 2*B*d*f*x + C*d*tan(f*x)^2 + C*d*tan(e)^2 - B*c*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*
tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)) - A*d*log(4*(tan(e
)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1
)) + C*d*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 -
2*tan(f*x)*tan(e) + 1)) + 2*C*c*tan(f*x) + 2*B*d*tan(f*x) + 2*C*c*tan(e) + 2*B*d*tan(e) + C*d)/(f*tan(f*x)^2*t
an(e)^2 - 2*f*tan(f*x)*tan(e) + f)